#include "StdAfx.h"
#include "Light.h"


CLight::CLight(void)
: m_fAmbient(0.f)
{
}

CLight::~CLight(void)
{
}

void CLight::Init(const CVector3D& vPosition, DATA_TYPE fAmbient, const CColor4& vColor)
{
	SetPosition(vPosition);
	m_fAmbient = fAmbient;
	m_vColor = vColor;
}

CRay CLight::GetRayToLightAndDistance(const CVector3D& vPoint, DATA_TYPE& fDistance) const
{
	CVector3D vDirection = GetPosition() - vPoint;
	vDirection = vDirection.GetNormalizedAndLength(fDistance);

	return CRay(vPoint + EPSILON * vDirection, vDirection);
}